#pragma once
#ifndef NES_H
#define NES_H

////////////////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include "M6502.h"
#include "PPU.h"
#include <SDL.h>

////////////////////////////////////////////////////////////////////////////////////////////////////

class NES {
    public:
        static NES*         GetInstance         ();
        virtual             ~NES                ();
        unsigned char       ReadMemory          ( unsigned short )const;
        void                WriteMemory         ( unsigned short, unsigned char );
        unsigned char       ReadVRAM            ( unsigned short )const;
        void                WriteVRAM           ( unsigned short, unsigned char );
        unsigned char       ReadSRAM            ( unsigned char );
        void                WriteSRAM           ( unsigned char, unsigned char );
        void                LoadCart            ( const std::string & );
        void                Start               ();
        void                LaunchSDL           ();
        void                Render              ( unsigned long* );

    private:
                            NES                 ();

        static NES*         m_Instance;
        unsigned char*      m_RAM;
        unsigned char*      m_VRAM;
        unsigned char*      m_SRAM;
        M6502*              m_6502;
        PPU*                m_PPU;
        bool                m_Running;
        SDL_Surface*        m_Screen;
};

////////////////////////////////////////////////////////////////////////////////////////////////////

#endif

////////////////////////////////////////////////////////////////////////////////////////////////////
